import requests


class Iaas:

    def __init__(self, base_url):
        self.base_url = base_url
        self.session = requests.Session()

    def inventory_instance_spec_list(self, specd):
        url = self.base_url + "/api/inventory/instance-spec/list"
        SpecId = []
        SpecId.append(specd)
        data = {"Page": 1, "PageSize": 50, "SpecId": SpecId, "Category": "GPU"}
        res = self.session.post(url=url,json=data)
        if res.status_code == 201:
            return res.json()


# if __name__ == '__main__':
specid = "egc-x866248ra-v1"
specid = "egc-x866248rg36cm-v1"
iaas = Iaas("http://iaas-console.iaas-pre.vrviu.com")
print(iaas.inventory_instance_spec_list(specid))
